]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - Super Polarity/ScreenManager.cs
Protoshow sprint.
[rbdr/super-polarity] / Super Polarity / ScreenManager.cs
index 04c10a4dec4095605ba6f137339e4aad1ac58458..b88741b3ecdea20e2c2b5ff202f47e2120d65ef9 100644 (file)
@@ -19,12 +19,22 @@ namespace SuperPolarity
 
         static public void Push(Screen screen)
         {
+            if (Screens.Count > 0)
+            {
+                Screens.Peek().Active = false;
+            }
+
+            screen.LoadContent();
+            screen.Active = true;
             Screens.Push(screen);
         }
 
         static public void Pop()
         {
-            Screens.Pop();
+            var screen = Screens.Pop();
+            screen.Active = false;
+            screen.CleanUp();
+            Screens.Peek().Active = true;
         }
 
         static public void Update(GameTime gameTime)
@@ -34,10 +44,7 @@ namespace SuperPolarity
 
         static public void Draw(SpriteBatch spriteBatch)
         {
-            foreach (Screen screen in Screens)
-            {
-                screen.Draw(spriteBatch);
-            }
+            Screens.Peek().Draw(spriteBatch);
         }
 
         internal static void SetGame(SuperPolarity game)